package com.kangaroo.myhome.model;

import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;

import java.io.Serializable;

/**
 * 用户模型
 * 
 * @author Louis
 * @date Jun 29, 2019
 */
public class ModdifyPasword implements Serializable {

    private static final long serialVersionUID = 1L;

    private String account;
    private String password;
    private String rePassword;

    public String getAccount() {
        return account;
    }

    public void setAccount(String account) {
        this.account = account;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getRePassword() {
        return rePassword;
    }

    public void setRePassword(String rePassword) {
        this.rePassword = rePassword;
    }

    public boolean compareTwicePasswordIsEquals() {
        return this.rePassword.equals(this.password);
    }

    public boolean compareOldAndDBPasswordIsEquals(String passwordDB) {
        BCryptPasswordEncoder bc = new BCryptPasswordEncoder();
        return bc.matches(this.password, passwordDB);

    }
}